package com.zdpx.pxframework.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zdpx.pxframework.system.api.entity.UserInfo;
import com.zdpx.pxframework.system.api.entity.RoleInfo;
import com.zdpx.pxframework.system.service.AdminService;
import com.zdpx.pxframework.system.service.RoleInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Set;


/**
 * 管理员 服务实现类
 *
 * @Description:
 * @Author: Cheng XiaoXiao
 * @Date: 2022-02-27 15:20:14
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    RoleInfoService roleInfoService;

    /**
     * 管理员的用户名信息
     */
    private static final String ADMIN_USER_NAME = "admin";

    /**
     * 判断用户是否为管理员
     *
     * @param userInfo 用户信息
     * @return 是否
     */
    @Override
    public boolean isAdmin(UserInfo userInfo) {
        return ADMIN_USER_NAME.equals(userInfo.getUserName());
    }

    /**
     * 获取所有的菜单标识列表
     *
     * @return 菜单标识列表
     */
    @Override
    public Set<String> getAllMenuKeys() {
        roleInfoService.list(new LambdaQueryWrapper<RoleInfo>());
        return null;
    }
}
